<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
 
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>

<script type="text/javascript">
    function deleteContendor() {
        if (confirm("Desea eliminar este contendor")) {
            return true;
        }
        return false;
    }
</script>

<div class="container">
    <div class="row"><br><br>
        <h2>Listado de Contendores</h2>
            <h5>Criterios de Busqueda</h5>
            <div class="hero-unit-min">
                <div class="buscar-form">
                     <form:form action="buscar" method="post" commandName="criterioBusqueda">
                                 <table border=0 cellspacing=0 cellpadding=0 width="100%" height="50px" bordercolor=red >
                                    <tr>
                                        <td>Contendor</td>
                                        <td><form:input path="nombre" size="10" cssClass="input-large"></form:input>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="6" align="right">
                                            <input type="submit" value="Buscar" class="btn btn-mini btn-primary"/>
                                            <a href="<c:url value='/pages/contendor/new'/>" class="btn btn-mini btn-primary">Nuevo</a>
                                        </td>
                                    </tr>                
                                </table>
                      </form:form>
                </div>  
            </div>
         </div>
     <br/>
                <div class="bs-docs-example">
                    <table class="table table-hover">
                            <tr>
                                <th>#</th>
                                <th>Contendor</th>
                                <th>Tipo</th>
                                <th>Imagen</th>
                                <th>Texto</th>
                                <th>Fecha Registro</th>
                                <th>Estado</th>
                                <th style="width: 150px;"></th>
                                <th style="width: 150px;"></th>
                            </tr>
                            <c:forEach var="contendor" items="${contendor}">
                                    <tr>
                                        <td>${contendor.idcontendor}</td>
                                        <td>${contendor.nocontendor}</td>
                                        <c:if test="${contendor.fltipo==1}">
                                            <td>Imagen</td>
                                        </c:if>
                                        <c:if test="${contendor.fltipo==2}">
                                            <td>Texto</td>
                                        </c:if>
                                        <td>${contendor.noimagen}</td>
                                        <td>${contendor.txtexto}</td>
                                        <td>${contendor.fcregistro}</td>                                        
                                        <c:if test="${contendor.idestado==1}">
                                            <td>Activo</td>
                                        </c:if>
                                        <c:if test="${contendor.idestado==0}">
                                            <td>Inactivo</td>
                                        </c:if>
                                        <td><a href="<c:url value='/pages/contendor/edit?id=${contendor.idcontendor}'/>"><i class="icon-edit"></i></a></td>
                                        <td><a href="<c:url value='/pages/contendor/delete?id=${contendor.idcontendor}'/>" onclick="if (deleteContendor()) { return true; } else { return false; }"><i class="icon-remove"></i></a></td>
                                    </tr>
                            </c:forEach>
                    </table>
                </div>
</div>
